<template>
  <div>
    <!-- //面包屑 -->
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>权限管理</el-breadcrumb-item>
      <el-breadcrumb-item>权限列表</el-breadcrumb-item>
    </el-breadcrumb>
    <!-- 卡片视图区域 -->
    <el-card>
      <!-- 表格数据渲染区域,根据用户基本信息数组渲染而来 -->
      <el-table :data="rightsList" border stripe>
        <el-table-column type="index" label="#"></el-table-column>
        <el-table-column label="权限名字" prop="authName"></el-table-column>
        <el-table-column label="路径" prop="path"></el-table-column>
        <el-table-column label="权限等级" prop="level">
          <!-- v-slot ele中的作用域插槽 -->
          <template v-slot='rowObj'>
            <el-tag type="success" v-if="rowObj.row.level == 0">一级</el-tag>
            <el-tag type="danger" v-if="rowObj.row.level == 1">二级</el-tag>
            <el-tag type="warning" v-if="rowObj.row.level == 2">三级</el-tag>
          </template>
        </el-table-column>
      </el-table>

      <!-- 分页 -->
      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="1"
        :page-sizes="[1, 3, 5, 8]"
        :page-size="1"
        layout="total, sizes, prev, pager, next, jumper"
        :total="1"
      ></el-pagination>
    </el-card>
  </div>
</template>

<script>
//
import { getUserRightsAPI } from '@/api'
export default {
  data() {
    return {
      //用户权限列表
      rightsList: []
    }
  },
  methods: {
    handleSizeChange() {},
    handleCurrentChange() {},
    // 请求权限用户列表
    async getRightsList() {
      const { data } = await getUserRightsAPI()
      if (data.meta.status != 200) return this.msg.waring('获取列表失败')
      this.rightsList = data.data
    }
  },
  created() {
    this.getRightsList()
  }
}
</script>

<style scoped>
</style>